/*
 * Copyright (c) 2023-2023 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <cstdint>
#include <gtest/gtest.h>
#include <memory>
#include <string>
#include <vector>

#ifdef L2_STANDARD
#include "file_ex.h"
#endif
#include "hks_chipset_platform_test.h"
#include "hks_client_service.h"
#include "hks_mem.h"
#include "hks_param.h"
#include "hks_test_log.h"
#include "hks_three_stage_test_common.h"

// directly invoke HuksCoreChipsetPlatformDecrypt
#include "base/security/huks/services/huks_standard/huks_engine/main/core_dependency/src/hks_chipset_platform_key_hardcoded.c"
#include "base/security/huks/services/huks_standard/huks_engine/main/core/src/hks_chipset_platform_decrypt.c"

using namespace testing::ext;
namespace Unittest::HksChipsetPlatformDecryptTest {
namespace {
std::vector<HksChipsetPlatformTestCase> DECRYPT_KEY_NORMAL_CASES = {
{
    .salt = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .tmpPk = {
        0x56, 0x66, 0x08, 0x04, 0x20, 0x5B, 0x15, 0xEA, 0x78, 0x12, 0xBE, 0xD9, 0x31, 0xBB, 0xC6, 0x0A,
        0x11, 0xAC, 0x14, 0x2D, 0xEA, 0xF5, 0x18, 0x21, 0x14, 0xC7, 0x17, 0xFF, 0xFD, 0xAB, 0x51, 0xA2,
        0x02, 0x9B, 0x22, 0x68, 0x90, 0x72, 0x33, 0x54, 0x1C, 0x06, 0x58, 0xAD, 0x71, 0x64, 0xC1, 0xA6,
        0x42, 0x1B, 0xDC, 0x03, 0x55, 0x64, 0x3C, 0xEA, 0x5D, 0x73, 0x9F, 0x0D, 0x41, 0x20, 0x18, 0x37,
    },
    .hmacMsg = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .iv = {
        0xEC, 0xD1, 0x0D, 0x9E, 0x5E, 0xDF, 0xBA, 0xB9, 0x1E, 0x26, 0xED, 0x32,
    },
    .aad = {
        0x9F, 0xDA, 0x88, 0x6D, 0x04, 0x67, 0xDB, 0xB8, 0xEB, 0xC4, 0x43, 0x0F, 0x71, 0x9D, 0xFF, 0xD0,
    },
    .mac = {
        0xE8, 0x62, 0x0C, 0x53, 0xB9, 0x2C, 0xA1, 0x4D, 0xCC, 0x0E, 0xA1, 0x7C, 0x71, 0xF2, 0x9E, 0xA3,
    },
    .cipher = {
        0x20,
    },
    .expectPlain = {
        0x11,
    },
},
{
    .salt = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .tmpPk = {
        0xC6, 0x5A, 0x5A, 0xC2, 0x3F, 0x45, 0xE6, 0x88, 0xE5, 0x11, 0x6F, 0xFE, 0xB6, 0xD4, 0x7A, 0xB6,
        0xD3, 0x2E, 0x85, 0x15, 0x73, 0x9B, 0x2C, 0x5D, 0x71, 0xC7, 0x6F, 0x68, 0x4E, 0xA8, 0xA4, 0xC8,
        0x7E, 0x3A, 0x23, 0x90, 0x2D, 0x95, 0xB4, 0x89, 0xCF, 0xE0, 0x25, 0x84, 0x78, 0xD0, 0x12, 0x48,
        0x29, 0x31, 0xE1, 0x10, 0x3D, 0x04, 0x9B, 0xF0, 0x6E, 0x88, 0xC9, 0xE0, 0x5B, 0xD0, 0xC4, 0xE6,
    },
    .hmacMsg = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .iv = {
        0xBE, 0x00, 0xCF, 0x61, 0x45, 0x2F, 0x19, 0x3F, 0x6F, 0x3F, 0xD9, 0x3A,
    },
    .aad = {
        0x3E, 0x69, 0x2A, 0xC1, 0xFA, 0xB9, 0xA7, 0x58, 0x86, 0x6D, 0xF9, 0x29, 0xA2, 0x28, 0x6D, 0xF9,
    },
    .mac = {
        0xF0, 0x4F, 0x20, 0x55, 0x2A, 0xFD, 0x05, 0x54, 0x0B, 0xD2, 0x74, 0xBB, 0x9F, 0xA3, 0x39, 0x1B,
    },
    .cipher = {
        0x99, 0x42, 0x78, 0xED,
    },
    .expectPlain = {
        0x11, 0x22, 0x33, 0x44,
    },
},
{
    .salt = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .tmpPk = {
        0xC7, 0xD6, 0x0A, 0xF1, 0xEC, 0x07, 0x08, 0xDB, 0x65, 0x49, 0x8A, 0x0E, 0x4B, 0x65, 0xFB, 0xB5,
        0xA9, 0x35, 0xE0, 0x5C, 0x71, 0x81, 0x8C, 0x52, 0x5C, 0xA8, 0x8A, 0xF2, 0x2B, 0x2E, 0x9B, 0x3F,
        0x74, 0x2F, 0xBC, 0x54, 0xB0, 0x99, 0x37, 0xBD, 0x63, 0x99, 0x7A, 0x41, 0x16, 0x84, 0xB8, 0x41,
        0xDD, 0x11, 0xA6, 0xA5, 0x41, 0x8D, 0x9A, 0xEF, 0x9D, 0x3E, 0x30, 0x5B, 0xE0, 0xBA, 0x84, 0xFF,
    },
    .hmacMsg = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .iv = {
        0x15, 0xCA, 0x69, 0x9E, 0xFE, 0xD5, 0xB9, 0xBB, 0xF0, 0x1A, 0x63, 0xBB,
    },
    .aad = {
        0x9B, 0xD1, 0x19, 0x88, 0xAE, 0x49, 0x8B, 0x30, 0x39, 0x41, 0xB2, 0x28, 0x58, 0xF8, 0xC2, 0x73,
    },
    .mac = {
        0x74, 0xDB, 0x05, 0x42, 0xBD, 0xC1, 0x1D, 0x59, 0x68, 0xEE, 0x12, 0xFC, 0x29, 0x4A, 0x60, 0x4A,
    },
    .cipher = {
        0x01, 0x44, 0xF6, 0x55, 0xD4, 0x46, 0xB3, 0xC6, 0x58, 0xC8, 0x5B, 0x17, 0xEC, 0x5A, 0x9E, 0xA9,
    },
    .expectPlain = {
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
    },
},
{
    .salt = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .tmpPk = {
        0x1C, 0x95, 0xED, 0xCA, 0x3E, 0x1F, 0xB5, 0x3A, 0x35, 0xEB, 0x9E, 0xAA, 0x22, 0xFB, 0x69, 0xC0,
        0x78, 0x53, 0x9F, 0xC1, 0x54, 0xDC, 0xBC, 0xC9, 0xCD, 0x84, 0xE6, 0xA6, 0x00, 0xAE, 0xE1, 0xE9,
        0xBD, 0x0F, 0x7B, 0x00, 0x20, 0x55, 0x16, 0x60, 0x56, 0xD1, 0xBB, 0x78, 0x74, 0xAC, 0x2B, 0x6F,
        0x96, 0xF0, 0x83, 0x4E, 0xA9, 0xAB, 0x8A, 0xC8, 0x30, 0xD5, 0x46, 0x9F, 0xB9, 0x05, 0xC7, 0x7B,
    },
    .hmacMsg = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .iv = {
        0x47, 0x1D, 0xA7, 0x5F, 0xD6, 0x1A, 0xCA, 0xBF, 0x6B, 0xFE, 0x91, 0x6C,
    },
    .aad = {
        0x8F, 0x08, 0xFC, 0x6A, 0x9C, 0xA9, 0x3C, 0x74, 0xEA, 0x2C, 0x89, 0x20, 0xD6, 0x93, 0xB5, 0x6F,
    },
    .mac = {
        0x26, 0x08, 0x08, 0xD7, 0xE2, 0xAA, 0xCB, 0x87, 0x5A, 0x5C, 0x67, 0xF8, 0xDA, 0x57, 0xBC, 0x76,
    },
    .cipher = {
        0x00, 0x34, 0x63, 0xBB, 0x04, 0xBF, 0xE7, 0x9F, 0x73, 0x5F, 0x41, 0x43, 0xFC, 0x8A, 0x9D, 0x8C,
        0x3A, 0x83, 0xD5, 0xEA, 0xB1, 0xEA, 0xDF, 0x16, 0xFB, 0xC4, 0xF7, 0x54, 0x62, 0xBB, 0xBB, 0xE3,
    },
    .expectPlain = {
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
    },
},
{
    .salt = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .tmpPk = {
        0xCC, 0x0B, 0x47, 0xBD, 0xBB, 0xF3, 0xA6, 0x6B, 0x97, 0x87, 0x36, 0xFF, 0x45, 0xDD, 0xAC, 0x5E,
        0xDD, 0xC8, 0x34, 0xB1, 0xA3, 0xC6, 0x42, 0x38, 0xD5, 0xC2, 0xC9, 0x0F, 0x4B, 0xFD, 0x6E, 0xF1,
        0x42, 0xA3, 0xA3, 0x39, 0x84, 0x77, 0xDA, 0x20, 0x50, 0xB8, 0x56, 0x7B, 0x87, 0x9C, 0x17, 0xD2,
        0xF1, 0xE4, 0x48, 0x86, 0x6B, 0xF7, 0xBB, 0xBC, 0x05, 0xAB, 0xC4, 0x23, 0xB7, 0x5C, 0x65, 0xA1,
    },
    .hmacMsg = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .iv = {
        0x5E, 0x2C, 0x66, 0x82, 0xA2, 0xEB, 0x8A, 0x94, 0x9B, 0xE1, 0x69, 0xB0,
    },
    .aad = {
        0xA9, 0xBC, 0xAF, 0xC6, 0xF3, 0xA5, 0x75, 0xEA, 0xA5, 0x9A, 0xA6, 0x8A, 0x5E, 0x2F, 0x82, 0x78,
    },
    .mac = {
        0xBC, 0x25, 0x6F, 0xA2, 0x56, 0x07, 0x8A, 0xEB, 0x9C, 0x26, 0x3C, 0xB4, 0x61, 0xAF, 0xA5, 0x1A,
    },
    .cipher = {
        0xAA, 0x14, 0x20, 0x9A, 0x65, 0x91, 0xA0, 0x76, 0x8D, 0xB3, 0xB0, 0xBE, 0xEA, 0xB8, 0x8A, 0x83,
        0xFE, 0xBC, 0x7B, 0x15, 0x68, 0x49, 0xF4, 0x50, 0xFA, 0x52, 0x98, 0x3F, 0x8A, 0xA7, 0xAF, 0xA9,
        0x72, 0xA6, 0xDC, 0x89, 0x1E, 0x4A, 0x60, 0x62, 0xD3, 0xDB, 0x81, 0xD0, 0x0C, 0x6D, 0x6A, 0xCF,
        0xBB, 0x04, 0xC9, 0xD0, 0x77, 0xD4, 0x99, 0x96, 0xDA, 0x5D, 0x52, 0x70, 0x10, 0x98, 0x4D, 0x48,
        0xF3, 0x44, 0xD4, 0x88, 0x1E, 0x5C, 0xC6, 0x57, 0xB3, 0xBD, 0xD0, 0x25, 0x23, 0x9C, 0xF7, 0x95,
        0xA0, 0xF7, 0xB8, 0x79, 0xEE, 0x9F, 0xA2, 0xEB, 0x55, 0x07, 0x5C, 0x3E, 0x1D, 0x2D, 0x15, 0x44,
        0x33, 0xB6, 0xBF, 0x41, 0x99, 0x0A, 0x71, 0xE7, 0xC9, 0xCE, 0x79, 0x41, 0x47, 0xF5, 0x33, 0xCF,
        0x3B, 0xBE, 0x9D, 0xE0, 0xCE, 0x9C, 0x4B, 0xC1, 0x96, 0x6B, 0x56, 0x14, 0x90, 0xBE, 0xEB, 0x20,
        0xF8, 0xF2, 0xEA, 0x0B, 0x9F, 0xE5, 0xA6, 0x7E, 0xFD, 0x40, 0x71, 0x3F, 0xF8, 0xBE, 0xDF, 0x65,
        0x4D, 0x04, 0xC4, 0x79, 0xFC, 0xCB, 0x97, 0xA5, 0x30, 0x85, 0x77, 0xD1, 0x24, 0xEE, 0x78, 0x51,
        0x73, 0xBA, 0x56, 0x2E, 0xA3, 0xEA, 0xD2, 0x41, 0x2F, 0x6F, 0x9B, 0x93, 0x0F, 0x39, 0x57, 0x72,
        0xA4, 0xBE, 0xE2, 0x67, 0xE1, 0xFD, 0xBA, 0x6D, 0x0B, 0xA7, 0xF4, 0x67, 0x79, 0x7D, 0x86, 0x30,
        0xA9, 0x89, 0x39, 0xEC, 0x12, 0x11, 0x47, 0xF1, 0x62, 0x98, 0x41, 0x69, 0xB0, 0xE6, 0x12, 0x8E,
        0x32, 0x45, 0xE1, 0x35, 0x8E, 0x08, 0x3C, 0x58, 0xFB, 0x33, 0x09, 0xCF, 0xDA, 0xC8, 0xD8, 0x9E,
        0xFD, 0x64, 0x44, 0xC9, 0xE8, 0xC4, 0x3A, 0x4A, 0xF9, 0xA6, 0x52, 0x53, 0xD7, 0x8A, 0xCE, 0x32,
        0x6C, 0x10, 0xA1, 0xAF, 0x3F, 0xCB, 0x52, 0x14, 0xB3, 0xA5, 0x89, 0x3F, 0xB9, 0x99, 0xC8, 0x55,
        0x4A, 0x12, 0x35, 0xB1, 0xE9, 0x9C, 0xC8, 0xDC, 0xB5, 0x5D, 0xA3, 0xB5, 0x97, 0xD6, 0x04, 0xF8,
        0xB5, 0xC8, 0x16, 0xBB, 0x87, 0x07, 0x9F, 0xCC, 0x80, 0x3A, 0x15, 0x0C, 0x3A, 0xA3, 0x5E, 0x4D,
        0x34, 0x67, 0xB5, 0xCD, 0x52, 0xC9, 0xE9, 0x97, 0x12, 0x32, 0xDC, 0xEE, 0xB8, 0x26, 0x4F, 0x46,
        0x2D, 0xB8, 0xC2, 0x79, 0xAA, 0xD7, 0x8A, 0x3B, 0xD6, 0xD4, 0x12, 0xB9, 0xE2, 0xEE, 0x2B, 0xB0,
        0xA7, 0xAE, 0x69, 0x6E, 0xA7, 0x1E, 0xD8, 0xC6, 0x00, 0x51, 0x3E, 0xE3, 0x3D, 0x0E, 0x2D, 0xE4,
        0x7A, 0xA6, 0x9E, 0xAE, 0x86, 0x62, 0x2D, 0x3A, 0x2A, 0x2C, 0xB8, 0x13, 0x5F, 0xA4, 0x31, 0x66,
        0x9F, 0xA4, 0x8E, 0xAF, 0xE9, 0x68, 0x56, 0x25, 0x64, 0xDB, 0x4C, 0x12, 0xF1, 0xED, 0x95, 0xF5,
        0x14, 0xA0, 0xE1, 0xF1, 0xCA, 0xE4, 0xEC, 0xA3, 0x03, 0xBD, 0x0A, 0x5B, 0x6D, 0xC4, 0xE8, 0x87,
        0x86, 0x94, 0xC5, 0x53, 0x3D, 0x47, 0x4C, 0x94, 0x5A, 0x6F, 0x73, 0x73, 0x3F, 0x0B, 0xBF, 0x0E,
        0x8F, 0x20, 0x43, 0xBA, 0x02, 0x06, 0xA6, 0xED, 0x49, 0xE1, 0x63, 0xAB, 0x8F, 0xDE, 0x6B, 0x97,
        0x25, 0x0C, 0x02, 0xDB, 0x41, 0x17, 0x25, 0x77, 0x60, 0xD3, 0x7B, 0x1D, 0xFE, 0x47, 0xA2, 0xE4,
        0x18, 0xE6, 0x45, 0xE4, 0x16, 0x36, 0xF6, 0xA5, 0x46, 0xE1, 0x0A, 0x5E, 0x0E, 0x04, 0xF0, 0x0E,
        0x95, 0x44, 0x2B, 0x37, 0x36, 0x4F, 0xB8, 0x47, 0x67, 0xB0, 0x1C, 0x84, 0x53, 0xEA, 0x72, 0xC3,
        0x5A, 0x9A, 0x2D, 0x2D, 0xB3, 0x3D, 0xE8, 0x31, 0xC5, 0x3D, 0x69, 0xD7, 0x8C, 0x6F, 0x69, 0x9E,
        0x29, 0x6C, 0x3B, 0xF3, 0xEE, 0x6F, 0x6C, 0xAE, 0x90, 0xD3, 0x63, 0x16, 0xB8, 0x73, 0xE7, 0x9F,
        0x5D, 0x3F, 0x5D, 0xBE, 0x0A, 0xE6, 0x99, 0xA3, 0x79, 0xC5, 0x9D, 0x26, 0x52, 0x19, 0xE8, 0xB1,
    },
    .expectPlain = {
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
        0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
    },
},
{
    .salt = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .tmpPk = {
        0x18, 0x1A, 0xBC, 0xA2, 0x47, 0xAB, 0xA1, 0xDF, 0xEF, 0x02, 0x0B, 0x01, 0x10, 0xF0, 0x53, 0x39,
        0x7B, 0x34, 0xD6, 0x56, 0x3D, 0x81, 0xD9, 0x93, 0x43, 0x4C, 0x07, 0x83, 0x97, 0x8F, 0xD2, 0x93,
        0xF3, 0xAD, 0x70, 0x92, 0x85, 0xD2, 0x3A, 0x81, 0xB2, 0x28, 0xCE, 0xD6, 0x48, 0xC0, 0x14, 0xB2,
        0x36, 0x8C, 0x9E, 0x37, 0x80, 0x05, 0x93, 0x1D, 0xE9, 0x7B, 0xAA, 0x91, 0xD8, 0x04, 0x6A, 0x62,
    },
    .hmacMsg = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .iv = {
        0x5D, 0x8E, 0xDF, 0x94, 0x93, 0x5D, 0x46, 0xF4, 0x54, 0xFD, 0x1A, 0x5A,
    },
    .aad = {
        0x04, 0x99, 0x6E, 0xB5, 0x05, 0xC6, 0x91, 0x9C, 0xF9, 0xFC, 0x81, 0xFC, 0x69, 0x3C, 0x3B, 0x44,
    },
    .mac = {
        0x76, 0x83, 0x9F, 0xA6, 0x6C, 0x62, 0x03, 0x15, 0x08, 0xFB, 0xDD, 0x36, 0xBF, 0xCD, 0x0F, 0x29,
    },
    .cipher = {
        0x59,
    },
    .expectPlain = {
        0x33,
    },
},
{
    .salt = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .tmpPk = {
        0x03, 0xDD, 0x88, 0x0D, 0x07, 0x31, 0x5B, 0x9A, 0xE5, 0x49, 0x31, 0xD3, 0xBC, 0xB9, 0xBB, 0x78,
        0xB8, 0x32, 0x8E, 0x2E, 0xD2, 0x77, 0xA1, 0xFF, 0x4D, 0x1B, 0xFA, 0x68, 0x54, 0x61, 0x9D, 0xB7,
        0x3F, 0xD7, 0x08, 0xCB, 0x91, 0x72, 0xD9, 0x76, 0x65, 0xE1, 0x1A, 0x75, 0x09, 0x8C, 0x13, 0x12,
        0x18, 0x3A, 0xDC, 0x3A, 0x11, 0x78, 0xAF, 0x1A, 0x0F, 0x99, 0x69, 0x7D, 0x7F, 0xF9, 0x24, 0xE6,
    },
    .hmacMsg = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .iv = {
        0x00, 0x5C, 0x85, 0x09, 0x4F, 0x23, 0xC5, 0x74, 0x73, 0x80, 0x36, 0x22,
    },
    .aad = {
        0x2F, 0xC9, 0x99, 0x34, 0x2C, 0x8F, 0x3B, 0xE2, 0xD4, 0x2F, 0x7A, 0xA3, 0x76, 0xFE, 0x09, 0xEA,
    },
    .mac = {
        0xC8, 0x83, 0x9C, 0x3D, 0x76, 0x15, 0xAF, 0x15, 0x2B, 0x54, 0xFE, 0xA2, 0x07, 0x6D, 0xD5, 0x41,
    },
    .cipher = {
        0x04, 0x6B, 0xAA, 0xEC,
    },
    .expectPlain = {
        0x33, 0x44, 0x55, 0x66,
    },
},
{
    .salt = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .tmpPk = {
        0x95, 0x52, 0xA1, 0xCC, 0xC8, 0x44, 0x16, 0xE4, 0xE5, 0x76, 0xF6, 0x54, 0xE7, 0xD1, 0xE7, 0x32,
        0x9D, 0xDE, 0x4F, 0x26, 0x4E, 0x85, 0xB5, 0xAC, 0x85, 0x41, 0x31, 0x25, 0xD1, 0x0D, 0xD2, 0x6F,
        0x9B, 0xA9, 0xD9, 0xDE, 0x4D, 0x59, 0xB5, 0x8F, 0x43, 0x40, 0x6A, 0x19, 0x30, 0x92, 0x60, 0xB7,
        0xA5, 0x49, 0x40, 0x3F, 0x54, 0x4A, 0x47, 0xCF, 0xD2, 0xB1, 0x52, 0x01, 0x31, 0x88, 0x0C, 0x9E,
    },
    .hmacMsg = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .iv = {
        0xC3, 0x0A, 0xCC, 0x72, 0xA9, 0xD9, 0x8D, 0xC9, 0x0C, 0xEC, 0x56, 0x6C,
    },
    .aad = {
        0x63, 0x94, 0x6C, 0xAE, 0xB2, 0x41, 0x65, 0x4E, 0x81, 0x46, 0x29, 0x07, 0x6D, 0x8E, 0xE3, 0x72,
    },
    .mac = {
        0x8B, 0x36, 0x67, 0x21, 0x96, 0x50, 0xB5, 0x9D, 0x0D, 0xEF, 0xBC, 0x86, 0xF3, 0xCB, 0xBF, 0xE1,
    },
    .cipher = {
        0x03, 0x29, 0x9B, 0x72, 0xAA, 0xC2, 0x2E, 0x60, 0xC9, 0x5E, 0x3C, 0xEC, 0xAB, 0xDD, 0xEC, 0x9F,
    },
    .expectPlain = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
},
{
    .salt = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .tmpPk = {
        0xF3, 0xE7, 0x92, 0x5A, 0xD7, 0x04, 0x5F, 0x1B, 0x07, 0x07, 0xED, 0x3E, 0x34, 0xB2, 0x4F, 0x1C,
        0xD1, 0xDC, 0x3F, 0x82, 0x4F, 0x21, 0x97, 0x1C, 0x42, 0xAF, 0x22, 0x15, 0x54, 0x57, 0x75, 0x62,
        0x7A, 0xFA, 0x0A, 0xEA, 0xDC, 0xFB, 0x24, 0x1F, 0x4C, 0xFC, 0x19, 0x5B, 0x29, 0x6D, 0xD5, 0x29,
        0x39, 0x40, 0xC7, 0x99, 0x38, 0x1C, 0x6D, 0x31, 0xEC, 0x85, 0x98, 0x46, 0x69, 0x3F, 0x15, 0xA4,
    },
    .hmacMsg = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .iv = {
        0xEC, 0xBB, 0xFD, 0xA0, 0x40, 0xBA, 0x15, 0x11, 0x92, 0x9D, 0xEB, 0x1F,
    },
    .aad = {
        0x97, 0xC7, 0xA8, 0xC0, 0xA4, 0x4B, 0x7B, 0xC0, 0x62, 0xE5, 0x01, 0x68, 0x7B, 0x8F, 0xBD, 0xAC,
    },
    .mac = {
        0x65, 0xA9, 0xDE, 0xF2, 0xAF, 0x25, 0x8E, 0x7F, 0xF8, 0x4A, 0xB4, 0x44, 0xC9, 0x84, 0x00, 0x1C,
    },
    .cipher = {
        0x5E, 0x4B, 0x58, 0x3E, 0xBE, 0x88, 0x9E, 0xF5, 0xBB, 0x11, 0x06, 0xB2, 0x68, 0x82, 0xA7, 0xF4,
        0xC7, 0xE0, 0xDE, 0xA6, 0xEF, 0x8E, 0x0C, 0x8C, 0x86, 0x3C, 0xD2, 0xE6, 0xEA, 0xF9, 0xC9, 0x02,
    },
    .expectPlain = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
},
{
    .salt = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .tmpPk = {
        0xF5, 0xE9, 0x44, 0x39, 0x9B, 0x17, 0x07, 0x66, 0xDC, 0x97, 0xA4, 0xE8, 0xB5, 0xE9, 0x48, 0xD8,
        0x6F, 0xC9, 0xBD, 0x64, 0x5D, 0x74, 0xFA, 0x64, 0xB7, 0x8A, 0xDA, 0xEC, 0xBC, 0xC7, 0xD1, 0x51,
        0x43, 0xEF, 0x36, 0xD5, 0x09, 0xD8, 0xC4, 0x39, 0x6E, 0x3C, 0x8D, 0xD8, 0x20, 0x9C, 0x7A, 0x75,
        0x4A, 0x52, 0x91, 0x93, 0x0B, 0xBF, 0xD6, 0xF4, 0x1F, 0x6F, 0x9B, 0x47, 0x7E, 0xD7, 0xBD, 0x7C,
    },
    .hmacMsg = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
    .iv = {
        0x57, 0x54, 0xB4, 0xCB, 0xFF, 0x65, 0xC2, 0xEF, 0x66, 0x73, 0x6B, 0x77,
    },
    .aad = {
        0xA2, 0x81, 0x20, 0x53, 0x41, 0xFA, 0xFD, 0x03, 0xD6, 0xCB, 0xC6, 0x9D, 0xAB, 0xED, 0xF0, 0x96,
    },
    .mac = {
        0x49, 0x0E, 0x83, 0x7F, 0xEB, 0x24, 0x05, 0xF3, 0x74, 0x36, 0xB2, 0x21, 0xD8, 0x8F, 0xE7, 0x14,
    },
    .cipher = {
        0xBF, 0x0B, 0xB7, 0x18, 0x7C, 0xF2, 0x7A, 0xFB, 0x18, 0x15, 0x47, 0xFD, 0x52, 0x8C, 0x15, 0x47,
        0xD3, 0xC0, 0xD6, 0x31, 0x0E, 0xDF, 0x15, 0x0D, 0xEF, 0x04, 0xAC, 0xB1, 0xCC, 0x6F, 0xF6, 0x7F,
        0xD5, 0x27, 0xD8, 0xA1, 0x8A, 0x9D, 0xE1, 0xC6, 0xB5, 0x94, 0x20, 0x4E, 0xB7, 0xA4, 0xC0, 0xCC,
        0x2C, 0x21, 0x8A, 0x4F, 0x5A, 0x9F, 0x3F, 0x1A, 0x7A, 0xB0, 0x39, 0x08, 0xF9, 0x46, 0x4B, 0x0B,
        0x40, 0x11, 0xC1, 0xCC, 0x1A, 0x23, 0x49, 0x4D, 0x02, 0x04, 0x37, 0x58, 0x76, 0xC2, 0xE5, 0xA5,
        0xEC, 0xBF, 0x31, 0x3F, 0x3F, 0x3A, 0x39, 0x43, 0x49, 0x9E, 0x7C, 0x08, 0x94, 0x8A, 0xB6, 0x76,
        0xDB, 0x17, 0xDB, 0x9F, 0x9D, 0x9F, 0x64, 0xDD, 0x7A, 0xA0, 0x10, 0xFD, 0x7D, 0xDB, 0xA8, 0xE8,
        0x16, 0xC6, 0xD9, 0xB2, 0x65, 0x02, 0x98, 0xFF, 0xAD, 0x20, 0x5A, 0x86, 0xB6, 0xC1, 0x70, 0x14,
        0x97, 0x03, 0xC6, 0xB3, 0x5B, 0x9E, 0xA2, 0x77, 0xBA, 0xCE, 0x83, 0x3B, 0x67, 0x76, 0x2E, 0x16,
        0x9E, 0xB2, 0x5F, 0x8E, 0x8A, 0x02, 0x58, 0x40, 0x10, 0x26, 0xA6, 0x14, 0x03, 0x7E, 0x04, 0x40,
        0x51, 0xD5, 0x40, 0xFB, 0x4C, 0xFD, 0xDD, 0x15, 0x94, 0x15, 0xB7, 0x46, 0xCC, 0xE3, 0x01, 0xAA,
        0x57, 0x22, 0x18, 0x1D, 0xCA, 0x31, 0x2D, 0x86, 0x88, 0x58, 0x64, 0xB8, 0x5C, 0x1B, 0x94, 0x18,
        0xB8, 0x36, 0xA5, 0xED, 0x72, 0x65, 0x27, 0x40, 0x8D, 0x1F, 0x56, 0xDB, 0x66, 0xB8, 0x85, 0xEB,
        0xC1, 0x93, 0xD8, 0x30, 0xA5, 0x37, 0xD5, 0x4D, 0xA6, 0x33, 0x3B, 0x23, 0x65, 0x21, 0x4F, 0xF8,
        0xF7, 0x15, 0xA3, 0x06, 0x65, 0x99, 0x5F, 0xE1, 0x9E, 0x66, 0x5D, 0x32, 0xFF, 0x31, 0x49, 0xC1,
        0xEA, 0x8B, 0xF4, 0xB6, 0xD9, 0xF8, 0x57, 0x83, 0x50, 0x87, 0x3B, 0x17, 0x33, 0x22, 0x7D, 0xE7,
        0x5C, 0xBA, 0x88, 0x93, 0x00, 0xAB, 0x90, 0xFE, 0x18, 0x28, 0xC7, 0x61, 0x0E, 0xC9, 0xE6, 0xA4,
        0x6D, 0x4B, 0x6E, 0x45, 0xEC, 0xD7, 0xC0, 0x1F, 0x7F, 0x04, 0xBA, 0x6B, 0x48, 0xD4, 0x04, 0x87,
        0xE9, 0x6D, 0xFD, 0x41, 0x1C, 0x70, 0xCA, 0xBD, 0xA8, 0x42, 0x86, 0xB1, 0x7D, 0xA6, 0xCF, 0xBC,
        0x1A, 0x34, 0xA5, 0xA5, 0xDA, 0xBF, 0x4D, 0x18, 0xDF, 0x17, 0x8E, 0x1B, 0x49, 0x28, 0x0E, 0xE1,
        0x41, 0xB8, 0x92, 0x3B, 0x5E, 0xCE, 0x80, 0xCD, 0xAC, 0x15, 0x96, 0xA3, 0xAF, 0xBE, 0x92, 0xE9,
        0x2E, 0x33, 0xBD, 0xAE, 0x1D, 0x9D, 0xFE, 0xC1, 0xA8, 0x27, 0x7D, 0x81, 0x3D, 0xFC, 0x11, 0xDE,
        0x7D, 0xA7, 0xB6, 0x45, 0x68, 0x01, 0x10, 0x26, 0xF0, 0xB0, 0x17, 0xD6, 0x4B, 0x37, 0x97, 0xCB,
        0x49, 0x3B, 0x48, 0x22, 0x91, 0xF6, 0x8B, 0xF0, 0xB0, 0xC5, 0xEC, 0x50, 0x7F, 0x38, 0x41, 0xDE,
        0xEE, 0x1F, 0x9D, 0x6B, 0xE7, 0x72, 0x33, 0xFF, 0x70, 0x8F, 0x19, 0xD8, 0xC1, 0x50, 0xE3, 0x03,
        0x7D, 0xFC, 0xC0, 0x69, 0x55, 0xAE, 0x47, 0xA4, 0x5A, 0xEC, 0x1A, 0xC7, 0x5E, 0xCF, 0x5A, 0x6A,
        0xDE, 0x9D, 0xAE, 0x36, 0xF2, 0xA5, 0xE9, 0xB1, 0x79, 0x95, 0x8F, 0x75, 0x03, 0x60, 0xDE, 0x07,
        0x7C, 0x2A, 0xAB, 0x21, 0xEF, 0xDB, 0x96, 0x89, 0x4F, 0x6E, 0x6F, 0x96, 0x6D, 0xCA, 0x7F, 0xEC,
        0xEF, 0x32, 0xCD, 0xE3, 0x40, 0x31, 0x03, 0x61, 0x2F, 0x03, 0x10, 0x14, 0xE9, 0xD3, 0xAC, 0x36,
        0x18, 0xCA, 0x33, 0x54, 0x90, 0x05, 0xA3, 0x95, 0xA6, 0x95, 0x6F, 0x75, 0x4F, 0x73, 0x0A, 0xDF,
        0x57, 0xE4, 0x67, 0x6B, 0x31, 0x94, 0xDD, 0x9C, 0x40, 0x44, 0x61, 0x1D, 0x73, 0xF8, 0x7C, 0x60,
        0x63, 0xB2, 0x2F, 0x9D, 0xC3, 0x78, 0xC2, 0x83, 0x06, 0xFE, 0x81, 0x80, 0xFC, 0xBB, 0xA6, 0x84,
    },
    .expectPlain = {
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
        0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x11, 0x22,
    },
},
};
} // anonymous namespace

class HksChipsetPlatformDecryptTest : public testing::Test {
public:
    static void SetUpTestCase(void);

    static void TearDownTestCase(void);

    void SetUp();

    void TearDown();
};

void HksChipsetPlatformDecryptTest::SetUpTestCase(void)
{
    HKS_LOG_E("set up cases");
}

void HksChipsetPlatformDecryptTest::TearDownTestCase(void)
{
}

void HksChipsetPlatformDecryptTest::SetUp()
{
    HKS_LOG_E("enter HksServiceInitialize");
    HksServiceInitialize();
    HKS_LOG_E("init end");
}

void HksChipsetPlatformDecryptTest::TearDown()
{
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest001
 * @tc.desc: tdd Normal process of chipset platform decrypt, expect ret == HKS_SUCCESS
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest001, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest001");
    for (size_t i = 0; i < DECRYPT_KEY_NORMAL_CASES.size(); ++i) {
        struct HksChipsetPlatformTestCase &t = DECRYPT_KEY_NORMAL_CASES[i];
        HKS_TEST_LOG_I("test case %zu / %zu, expected plain length = %zu",
            (i + 1), DECRYPT_KEY_NORMAL_CASES.size(), t.expectPlain.size());
        auto decryptParams = CipherMaterialsToDecryptInputParams(t);
        WrapParamSet decryptParamSet{};
        int32_t ret = InitParamSet(&decryptParamSet.s, decryptParams.data(), decryptParams.size());
        EXPECT_EQ(ret, HKS_SUCCESS);

        std::vector<uint8_t> plainText(t.cipher.size());
        struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
        ret = HuksCoreChipsetPlatformDecrypt(decryptParamSet.s, HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA,
            &plainBlob);
        ASSERT_EQ(ret, HKS_SUCCESS);
        ASSERT_EQ(plainBlob.size, t.expectPlain.size());
        ASSERT_EQ(memcmp(plainBlob.data, t.expectPlain.data(), plainBlob.size), 0);
        HKS_TEST_LOG_I("test case %zu / %zu end", (i + 1), DECRYPT_KEY_NORMAL_CASES.size());
    }
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest002
 * @tc.desc: tdd abnormal case, pass nullptr as paramSet
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest002, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest002");
    struct HksChipsetPlatformTestCase t(DECRYPT_KEY_NORMAL_CASES[0]);
    std::vector<uint8_t> plainText(t.cipher.size());
    struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
    int32_t ret = HuksCoreChipsetPlatformDecrypt(nullptr, HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA, &plainBlob);
    ASSERT_NE(ret, HKS_SUCCESS);
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest003
 * @tc.desc: tdd abnormal case, incorrect count of params in paramSet
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest003, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest003");
    struct HksChipsetPlatformTestCase t(DECRYPT_KEY_NORMAL_CASES[0]);
    auto decryptParams = CipherMaterialsToDecryptInputParams(t);
    size_t correctCount = decryptParams.size();

    auto run = [&t, &decryptParams]() {
        WrapParamSet decryptParamSet {};
        int32_t ret = InitParamSet(&decryptParamSet.s, decryptParams.data(), decryptParams.size());
        EXPECT_EQ(ret, HKS_SUCCESS);

        std::vector<uint8_t> plainText(t.cipher.size());
        struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
        ret = HuksCoreChipsetPlatformDecrypt(decryptParamSet.s, HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA,
            &plainBlob);
        ASSERT_NE(ret, HKS_SUCCESS);
    };

    // add one useless param
    decryptParams.insert(decryptParams.begin(), HksParam{
        .tag = HKS_TAG_ALGORITHM,
        .uint32Param = 0,
    });
    ASSERT_EQ(decryptParams.size(), correctCount + 1);
    run();
    decryptParams.erase(decryptParams.begin());

    // remove one necessary param
    decryptParams.erase(decryptParams.begin());
    ASSERT_EQ(decryptParams.size(), correctCount - 1);
    run();
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest004
 * @tc.desc: tdd abnormal case, params in paramSet repeat
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest004, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest004");
    struct HksChipsetPlatformTestCase t(DECRYPT_KEY_NORMAL_CASES[0]);
    auto decryptParams = CipherMaterialsToDecryptInputParams(t);

    // repeat one param
    decryptParams.emplace_back(decryptParams[0]);

    WrapParamSet decryptParamSet {};
    int32_t ret = InitParamSet(&decryptParamSet.s, decryptParams.data(), decryptParams.size());
    EXPECT_EQ(ret, HKS_SUCCESS);

    std::vector<uint8_t> plainText(t.cipher.size());
    struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
    ret = HuksCoreChipsetPlatformDecrypt(decryptParamSet.s, HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA, &plainBlob);
    ASSERT_NE(ret, HKS_SUCCESS);
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest005
 * @tc.desc: tdd abnormal case, param in paramSet repeat has nullptr blob
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest005, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest005");
    struct HksChipsetPlatformTestCase t(DECRYPT_KEY_NORMAL_CASES[0]);
    auto decryptParams = CipherMaterialsToDecryptInputParams(t);

    WrapParamSet decryptParamSet {};
    int32_t ret = InitParamSet(&decryptParamSet.s, decryptParams.data(), decryptParams.size());
    EXPECT_EQ(ret, HKS_SUCCESS);

    decryptParamSet.s->params[0].blob.data = nullptr;
    decryptParamSet.s->params[0].blob.size = 0;

    std::vector<uint8_t> plainText(t.cipher.size());
    struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
    ret = HuksCoreChipsetPlatformDecrypt(decryptParamSet.s, HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA, &plainBlob);
    ASSERT_NE(ret, HKS_SUCCESS);
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest006
 * @tc.desc: tdd abnormal case, invalid salt type
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest006, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest006");
    struct HksChipsetPlatformTestCase t(DECRYPT_KEY_NORMAL_CASES[0]);
    auto decryptParams = CipherMaterialsToDecryptInputParams(t);

    WrapParamSet decryptParamSet {};
    int32_t ret = InitParamSet(&decryptParamSet.s, decryptParams.data(), decryptParams.size());
    EXPECT_EQ(ret, HKS_SUCCESS);

    std::vector<uint8_t> plainText(t.cipher.size());
    struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
    ret = HuksCoreChipsetPlatformDecrypt(decryptParamSet.s,
        static_cast<enum HksChipsetPlatformDecryptScene>(HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA + 1), &plainBlob);
    ASSERT_NE(ret, HKS_SUCCESS);
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest007
 * @tc.desc: tdd abnormal case, invalid pub key length
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest007, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest007");
    struct HksChipsetPlatformTestCase t(DECRYPT_KEY_NORMAL_CASES[0]);

    size_t correctSize = t.tmpPk.size();
    t.tmpPk = {t.tmpPk.begin(), t.tmpPk.begin() + t.tmpPk.size() / 2};
    EXPECT_EQ(t.tmpPk.size() * 2, correctSize);

    auto decryptParams = CipherMaterialsToDecryptInputParams(t);

    WrapParamSet decryptParamSet {};
    int32_t ret = InitParamSet(&decryptParamSet.s, decryptParams.data(), decryptParams.size());
    EXPECT_EQ(ret, HKS_SUCCESS);

    std::vector<uint8_t> plainText(t.cipher.size());
    struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
    ret = HuksCoreChipsetPlatformDecrypt(decryptParamSet.s, HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA, &plainBlob);
    ASSERT_NE(ret, HKS_SUCCESS);
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest008
 * @tc.desc: tdd abnormal case, invalid salt length
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest008, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest008");
    struct HksChipsetPlatformTestCase t(DECRYPT_KEY_NORMAL_CASES[0]);

    size_t correctSize = t.salt.size();
    t.salt = {t.salt.begin(), t.salt.begin() + t.salt.size() / 2};
    EXPECT_EQ(t.salt.size() * 2, correctSize);

    auto decryptParams = CipherMaterialsToDecryptInputParams(t);

    WrapParamSet decryptParamSet {};
    int32_t ret = InitParamSet(&decryptParamSet.s, decryptParams.data(), decryptParams.size());
    EXPECT_EQ(ret, HKS_SUCCESS);

    std::vector<uint8_t> plainText(t.cipher.size());
    struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
    ret = HuksCoreChipsetPlatformDecrypt(decryptParamSet.s, HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA, &plainBlob);
    ASSERT_NE(ret, HKS_SUCCESS);
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest009
 * @tc.desc: tdd abnormal case, invalid customInfo length
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest009, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest009");
    struct HksChipsetPlatformTestCase t(DECRYPT_KEY_NORMAL_CASES[0]);

    size_t correctSize = t.hmacMsg.size();
    t.hmacMsg = {t.hmacMsg.begin(), t.hmacMsg.begin() + t.hmacMsg.size() / 2};
    EXPECT_EQ(t.hmacMsg.size() * 2, correctSize);

    auto decryptParams = CipherMaterialsToDecryptInputParams(t);

    WrapParamSet decryptParamSet {};
    int32_t ret = InitParamSet(&decryptParamSet.s, decryptParams.data(), decryptParams.size());
    EXPECT_EQ(ret, HKS_SUCCESS);

    std::vector<uint8_t> plainText(t.cipher.size());
    struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
    ret = HuksCoreChipsetPlatformDecrypt(decryptParamSet.s, HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA, &plainBlob);
    ASSERT_NE(ret, HKS_SUCCESS);
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest010
 * @tc.desc: tdd abnormal case, invalid plainText length
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest010, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest010");
    struct HksChipsetPlatformTestCase t(DECRYPT_KEY_NORMAL_CASES[0]);

    auto decryptParams = CipherMaterialsToDecryptInputParams(t);

    WrapParamSet decryptParamSet {};
    int32_t ret = InitParamSet(&decryptParamSet.s, decryptParams.data(), decryptParams.size());
    EXPECT_EQ(ret, HKS_SUCCESS);

    std::vector<uint8_t> plainText(t.cipher.size() + t.cipher.size());
    struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
    ret = HuksCoreChipsetPlatformDecrypt(decryptParamSet.s, HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA, &plainBlob);
    ASSERT_NE(ret, HKS_SUCCESS);
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest011
 * @tc.desc: tdd abnormal case, cipher length is not the multiple of 16
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest011, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest011");
    struct HksChipsetPlatformTestCase t(DECRYPT_KEY_NORMAL_CASES[0]);
    
    t.cipher.emplace_back(1);

    auto decryptParams = CipherMaterialsToDecryptInputParams(t);

    WrapParamSet decryptParamSet {};
    int32_t ret = InitParamSet(&decryptParamSet.s, decryptParams.data(), decryptParams.size());
    EXPECT_EQ(ret, HKS_SUCCESS);

    std::vector<uint8_t> plainText(t.cipher.size());
    struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
    ret = HuksCoreChipsetPlatformDecrypt(decryptParamSet.s, HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA, &plainBlob);
    ASSERT_NE(ret, HKS_SUCCESS);
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest012
 * @tc.desc: tdd abnormal case, cipher length is out of range
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest012, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest012");
    struct HksChipsetPlatformTestCase t(DECRYPT_KEY_NORMAL_CASES[0]);
    
    t.cipher = std::vector<uint8_t>(PLATFORM_KEY_TEXT_MAX_LEN + 1);

    auto decryptParams = CipherMaterialsToDecryptInputParams(t);

    WrapParamSet decryptParamSet {};
    int32_t ret = InitParamSet(&decryptParamSet.s, decryptParams.data(), decryptParams.size());
    EXPECT_EQ(ret, HKS_SUCCESS);

    std::vector<uint8_t> plainText(t.cipher.size());
    struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
    ret = HuksCoreChipsetPlatformDecrypt(decryptParamSet.s, HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA, &plainBlob);
    ASSERT_NE(ret, HKS_SUCCESS);
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest013
 * @tc.desc: tdd abnormal case, invalid aad length
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest013, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest013");
    struct HksChipsetPlatformTestCase t(DECRYPT_KEY_NORMAL_CASES[0]);
    
    t.aad.emplace_back(1);

    auto decryptParams = CipherMaterialsToDecryptInputParams(t);

    WrapParamSet decryptParamSet {};
    int32_t ret = InitParamSet(&decryptParamSet.s, decryptParams.data(), decryptParams.size());
    EXPECT_EQ(ret, HKS_SUCCESS);

    std::vector<uint8_t> plainText(t.cipher.size());
    struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
    ret = HuksCoreChipsetPlatformDecrypt(decryptParamSet.s, HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA, &plainBlob);
    ASSERT_NE(ret, HKS_SUCCESS);
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest014
 * @tc.desc: tdd abnormal case, invalid iv length
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest014, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest014");
    struct HksChipsetPlatformTestCase t(DECRYPT_KEY_NORMAL_CASES[0]);
    
    t.iv.emplace_back(1);

    auto decryptParams = CipherMaterialsToDecryptInputParams(t);

    WrapParamSet decryptParamSet {};
    int32_t ret = InitParamSet(&decryptParamSet.s, decryptParams.data(), decryptParams.size());
    EXPECT_EQ(ret, HKS_SUCCESS);

    std::vector<uint8_t> plainText(t.cipher.size());
    struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
    ret = HuksCoreChipsetPlatformDecrypt(decryptParamSet.s, HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA, &plainBlob);
    ASSERT_NE(ret, HKS_SUCCESS);
}

/**
 * @tc.name: HksChipsetPlatformDecryptTest.HksChipsetPlatformDecryptTest015
 * @tc.desc: tdd abnormal case, invalid mac length
 * @tc.type: FUNC
 */
HWTEST_F(HksChipsetPlatformDecryptTest, HksChipsetPlatformDecryptTest015, TestSize.Level0)
{
    HKS_LOG_E("enter HksChipsetPlatformDecryptTest015");
    struct HksChipsetPlatformTestCase t(DECRYPT_KEY_NORMAL_CASES[0]);
    
    t.mac.emplace_back(1);

    auto decryptParams = CipherMaterialsToDecryptInputParams(t);

    WrapParamSet decryptParamSet {};
    int32_t ret = InitParamSet(&decryptParamSet.s, decryptParams.data(), decryptParams.size());
    EXPECT_EQ(ret, HKS_SUCCESS);

    std::vector<uint8_t> plainText(t.cipher.size());
    struct HksBlob plainBlob = { .size = plainText.size(), .data = plainText.data() };
    ret = HuksCoreChipsetPlatformDecrypt(decryptParamSet.s, HKS_CHIPSET_PLATFORM_DECRYPT_SCENE_TA_TO_TA, &plainBlob);
    ASSERT_NE(ret, HKS_SUCCESS);
}
}
